<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>for标签使用</title>
</head>
<body>
<table>
<thead>
    <tr>
        <th>编号</th>
        <th>名称</th>
        <th>价格</th>
    </tr>
</thead>
{#正向遍历#}
{#    {% for tprice in prices %}#}
{#        <tr>#}
{#            <td>{{ tprice.name }}</td>#}
{#            <td>{{ tprice.price }}</td>#}
{#        </tr>#}
{#    {% endfor %}#}
{#反向遍历：名称从上往下改为从下往上#}
    {% for tprice in prices reversed%}
        <tr>
            <td>{{ forloop.counter0 }}</td>
            <td>{{ tprice.name }}</td>
            <td>{{ tprice.price }}</td>
        </tr>
    {% empty %}
        <tr>消失了</tr>
    {% endfor %}
</table>
<div>
{#字典遍历#}
    {% for key,value in dire.items  %}
        <p>{{ key }}:{{ value }}</p>
    {% endfor %}
</div>
</body>
</html>